<script type="text/javascript">
$(document).ready(function()
				{
				$(".checkbox").click(function(){
												if ($(this).is(":checked"))
												{
													
													$val=parseInt($("#checknum").val(),10);
													$val=$val+1;
													$("#checknum").val($val);

												}
												else
												{
													$val=parseInt($("#checknum").val(),10);
													$val=$val-1;
													$("#checknum").val($val);
												}
												});
				});
	function validate()
	{
		$checked=0;
		$numpro=parseInt($("#countcheck").val(),10);
		$("input:checkbox").each(function(){
											if ($(this).is(":checked"))
													$checked++;
											});
		if ($checked==0)
		{
			alert("Bạn chưa chọn sản phẩm nào");
			return false;			
		}
		else
			return true;
	}
</script>

<div id="diemchuan_main">

<fieldset>
<legend>Chọn Sản Phẩm</legend>
<?php
	echo $this->Form->create('Diemchuan', array('url'=>array('controller'=>'diemchuans','action' => 'themdiemchuan',$kehoach_id),'type'=>'post','onsubmit'=>'return validate()'));
		echo $form->hidden('checknum',array('value'=>"0",'id'=>'checknum'));
		echo $form->hidden('countcheck',array('value'=>count($hanghoas),'id'=>'countcheck'));
		$i=0;
		foreach ($hanghoas as $hh_id => $tenhh):
			echo $form->checkbox('checkbox'.$i,array('id'=>$i,'id'=>'checkbox'.$i,'value'=>$hh_id,'hidden'=>False));
			echo $form->hidden($hh_id,array('value'=>$tenhh));
			echo $this->Form->label('',$tenhh);
			$i++;
		endforeach;
?>
</fieldset>

</div>
<?php echo $this->Form->end('Lập Điểm Chuẩn',false);?>

</div>